% core_1_VIMS.m
%
% mfile to process core_1
% provides core specific information needed in processing as well as some
% basic metadata
%
% by Patrick Dickhudt - Jan. 2011  pdickhudt@usgs.gov
%
% filter and data file names
dfld = '/Users/cwright/Desktop/untitled folder 2'; % folder containing data file
ffld = '/Users/cwright/Desktop/untitled folder 2'; % folder containing filter file

filein = fullfile(dfld,'YR180710-11.txt');   % time series data file
filein2 = fullfile(ffld,'S6620filters.csv');  % filter data file

% Bottle switch times -- these are the times that the water first enters
% the bottles They are EDT. Computer is NOT set for EST.
%NOTE: This is actually as EST since the computer for this run was set as
%EST but the Erosion log sheet was recorded as EDT.
day = '07/12/2018';
tstr{1}=[day ' 10:01:00'];  % 0.01 tau  %verify start time from the file. this time must be After the first record time
tstr{2}=[day ' 10:30:10']; % 0.05 
tstr{3}=[day ' 10:50:00']; % 0.1
tstr{4}=[day ' 11:10:00']; % 0.2
tstr{5}=[day ' 11:30:00']; % 0.3
tstr{6}=[day ' 11:50:00']; % 0.45
tstr{7}=[day ' 12:10:00']; % 0.6
tstr{8}=[day ' 12:30:00']; % end time of last step.  check times in file!



% make struct with core specific info

% the following need to be editted for each core
crinfo.ntun = 2;                    % turbidimeter number (1 or 2) --- core A is typically 1 and core B is typically 2
crinfo.rpmn = 2;                    % motor number (1 or 2) --- core A is typically 1 and core B is typically 2
crinfo.subsamp = 'n';               % were bottle samples subsamples 'y' or 'n'
crinfo.coren = 'S6620_CoreB';         % core number
crinfo.titlestr ='S6620 Core B';       % for labelling plots - replace underscores with dashes etc. to improve appearance
crinfo.temp = 24;                   % water temp (C)
crinfo.lat = 37.5522;              % latitude
crinfo.lon = -76.8620;             % longitude
%crinfo.depth = ;                 % approximate depth (m)
crinfo.time  = '10-July-2018 11:45'; % core collection time... in STANDARD TIME!!! EST for east coast.
% the time here has been ajusted to EST.
crinfo.corer = 'GOMEX box-core with sub-core';% coring device
crinfo.vessel = 'R/V Heron';     % coring platform
crinfo.op = 'C.Wright';     % operator
crinfo.timebase = 'EDT';            % time base (it is OK if use clock time for analysis)

% note any relevant info, core description, etc.
crinfo.note = {'connection loose in front for half of stress 0.2 and all of stress 0.3, lines 3 and 4 backward into cap';
               %'Prelim Turbid fig shows that 0.6 step was skipped';
               %'of core before experiment began';
               %'Resulted in higher NTUs than core B';
               %'~ 4 mm surface relief';
               %'slightly hummocky surface';
               %'some worm tubes'
               };
           
% the following are general and likely apply to all cores for a given
% system
crinfo.system = {'VIMS'}; % erosion system used
crinfo.tube = 100;  % turbidimeter to bottle tube length (cm)
crinfo.tstr = tstr;
crinfo.nsteps=7;
%crinfo.Aeff=0.0088382; %[m^2] effective area of sediment surface in core. - 4.5 inch OD tube (slow corer)
crinfo.Aeff=0.0068337; %[m^2] effective area of sediment surface in core. - 4 inch OD tube (multicorer)
%VIMS SYSTEM uses 4 inch OD tubes

crinfo.fields = {'crinfo = core / system specific data';
                 'ntun = turbidimeter number (1 or 2)';
                 'rpmn = motor number (1 or 2)';
                 'subsamp = were bottle samples subsamples y or n (string)';
                 'coren = core number';
                 'titlestr = for labelling plots - replace underscores with dashes etc. to improve appearance';
                 'temp = water temp (C)';
                 'lat = latitude';
                 'lon = longitude';
                 'depth = approximate depth (m)';
                 'time = core collection time';
                 'corer = coring device';
                 'vessel = coring platform';
                 'op = operator';
                 'timebase = time base (GMT,EST, etc.)';
                 'note = relevant info, core description, etc.';
                 'system = erosion system used';
                 'tube = turbidimeter to bottle tube length (cm)';
                 'tstr = bottle switch times';
                 'nsteps = number of steps';
                 'Aeff = [m^2] effective area of sediment surface in core'};


[tsdat,stepdat,erdat,fitdat]=procerode3_VIMS(filein,filein2,crinfo);

close('all')


open([crinfo.coren '_er.fig'])
open(['M_' crinfo.coren '.fig'])
open(['tau_' crinfo.coren '.fig'])
